package com.gxa.learning.core.pojo;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Date;

/**
 * @author YXQ
 * @date 2021/12/1 20:11
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "tb_user")
public class User {
    /**
     * 用户的编号
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "user_id")
    @ApiModelProperty(name = "id", value = "用户编号", dataType = "Long", example = "1")
    private Long id;

    /**
     * 必填项，用户一键登录时，会自动将用户名设置为：
     * “用户”+手机号的格式
     * 用户的姓名
     */
    @Column(name = "user_name")
    @ApiModelProperty(name = "name", value = "学员姓名", dataType = "string", example = "严晓其")
    private String name;

    /**
     * 用户的盐值，加密时用
     */
    @Column(name = "user_salt")
    @JsonIgnore
    private String salt;

    /**
     * 用户的密码
     * JsonIgnore给前端返回json时排除字段
     */
    @Column(name = "user_pwd")
    @JsonIgnore
    private String password;

    /**
     * 必填项
     * 用户的电话号码
     */
    @Column(name = "user_phone")
    @ApiModelProperty(name = "phone", value = "联系电话", dataType = "string", example = "15583750208")
    private String phone;

    /**
     * 用户的学院名称
     */
    @Column(name = "user_student_name")
    private String studentName;

    /**
     * 用户的公司名称
     */
    @Column(name = "user_company_name")
    @ApiModelProperty(name = "companyName", value = "公司", dataType = "String", example = "国信安")
    private String companyName;

    /**
     * 用户的部门名称
     */
    @Column(name = "user_department_name")
    @ApiModelProperty(name = "departmentName", value = "部门", dataType = "String", example = "J268")
    private String departmentName;

    /**
     * 用户的职位
     */
    @Column(name = "user_position")
    @ApiModelProperty(name = "position", value = "职位", dataType = "String", example = "产品经理")
    private String position;

    /**
     * 用户的邮箱
     */
    @Column(name = "user_email")
    @ApiModelProperty(name = "email", value = "邮箱地址", dataType = "String", example = "2106215434@qq.com")
    private String email;

    /**
     * 必填项
     * 用户状态, 表示用户是否创建成功,默认0,普通用户注册时,注意弄成1
     * 0.正常 1.待审核
     */
    @Column(name = "user_status")
    private Integer status;

    /**
     * 登录类型: 1.手机网页端(这次项目算小程序端) 2.pc网页端 3.手机app端
     */
    @Column(name = "user_login_type")
    private Integer loginType;

    /**
     * 权限令牌token
     */
    @Column(name = "user_token")
    private String token;

    /**
     * 用户的上次登录时间，XXX欢迎回来，XXX天未见
     */
    @Column(name = "user_last_login_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastLoginTime;

    /**
     * 记录用户连接时的IP地址
     */
    @Column(name = "user_ip_address")
    private String ipAddress;

    /**
     * 用户头像
     */
    @Column(name = "user_head_photo")
    @ApiModelProperty(name = "photo", value = "头像", dataType = "String", example = "xxx.jpg")
    private String photo;
}
